export function getTreedepar(arr) {
  const map = {}
  const newArr = []
  arr.forEach(item => {
    if (!item.children) {
      item.children = []
    }
    map[item.id] = item
  })
  // console.log(map)
  arr.forEach(item => {
    const parent = map[item.pid]
    if (parent) {
      parent.children.push(item)
    } else {
      newArr.push(item)
    }
  })
  // console.log(newArr)
  return newArr
}
